class NewsController < ApplicationController
before_filter :admin_required, :except => [:index, :show]

  def index
	@new_news = News.new_news
	
  end
#new news
  def new
	@news = News.new
  end
#show news
  def show
	@news = News.find(params[:id])
  end
#create new news
  def create
	@news = News.new(params[:news])
	if @news.save
	  flash[:notice] = 'News Successfully Scheduled'
	  redirect_to :action => "index"
	else
	  render :action => "new"
	end
  end
#delete news
  def destroy
	@news = News.find(params[:id])
 	@news.destroy

 	flash[:notice] = 'Event successfully cancelled'
 	redirect_to :action => "index"
  end
#edit news
  def update
	@news = News.find(params[:id])

	if @news.update_attributes(params[:news])
	  flash[:notice] = 'Event successfully updated.'
	  redirect_to :action => "show", :id => params[:id]
	else
	  render :action => "edit"
	end
  end
#edit news
def edit
	@news= News.find(params[:id])
  end
end
